package com.pet.shop.controller.sys;

import com.pet.shop.entity.option.DataOptionVal;
import com.pet.shop.service.option.IDataOptionService;
import com.pet.shop.utils.ApiResultUtil;
import com.pet.shop.vo.DataOptionValListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

@RequestMapping("/web/option/")
@RestController
public class DataOptionController {

    @Autowired
    private IDataOptionService dataOptionService;

    /**
     *
     * @return
     */
    @RequestMapping("/save")
    public Map<String, Object> relayList(DataOptionVal val){
        dataOptionService.saveDataOptionVal(Arrays.asList(val));
        return ApiResultUtil.success("");
    }

    @RequestMapping("/saveList")
    public Map<String, Object> relayList(DataOptionValListVo valListVo){
        dataOptionService.saveDataOptionVal(valListVo.getDataOptions());
        return ApiResultUtil.success("");
    }
}
